package com.elong.businesstravel.protocol.login;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONObject;

import com.elong.businesstravel.entitys.AccountInfo;
import com.elong.businesstravel.protocol.baseresponse.BaseELongJsonHttpResponse;

public class MemberGetUseBonusResponse extends BaseELongJsonHttpResponse {

	public List<AccountInfo> accountInfos = new ArrayList<AccountInfo>();
	
	@Override
	public void onSuccess(int statusCode, Header[] headers,
			JSONObject mainJsonObject) throws Throwable {
		JSONObject responseJsonObject = mainJsonObject.optJSONObject("response");
		JSONArray scoreJsonArray = responseJsonObject.optJSONArray("score");
		for (int i = 0; i < scoreJsonArray.length(); i++) {
			JSONObject itemJsonObject = scoreJsonArray.optJSONObject(i);
			AccountInfo accountInfo = new AccountInfo();
			accountInfo.addscore = itemJsonObject.optString("addscore","");
			accountInfo.usescore = itemJsonObject.optString("usescore","");
			accountInfo.resone = itemJsonObject.optString("resone","");
			accountInfo.addtime = itemJsonObject.optString("addtime","");
			accountInfo.endtime = itemJsonObject.optString("endtime","");
			accountInfo.status = itemJsonObject.optString("status","");
			accountInfo.statusinfo = itemJsonObject.optString("statusinfo","");
			accountInfo.typeinfo = itemJsonObject.optString("typeinfo","");
			accountInfo.usedorderid = itemJsonObject.optString("usedorderid","");
			
			accountInfos.add(accountInfo);

		}
	}

}
